The storage
duration of the newobject is from the point of creation until the operator delete destroys it by deallocating
its memory, or until the end of the program.
By default,
an allocation failure (such as insufficient or fragmented heap memory) results in the predefined exception bad_alloc being thrown.
You should
use the delete operator to remove all memory which has been allocated by the new operator. Failure to free memory can result in memory leaks.
The delete operator offers dynamic storage deallocation, deallocating a memory block allocated by a
previous call to new.
Your program
should always be prepared to catch the bad_alloc exception before trying to
access the new object (unless you use a new-handler).
A request for
allocation of 0 bytes returns a non-null pointer. Repeated requests for
zero-size allocations return distinct, non-null pointers.